function range(start, end, stepSize, length){
	if(stepSize == undefined){
		stepSize = 1;
	}
	if(end == undefined){
		end = start + stepSize *(length - 1);
	}
	var result = [];
	for(; start <=end; start += stepSize){
		result.push(start);
	}
	return result;
}
	
(function() {
	var names = ["Sunday", "Monday", "Tuesday", "wednesday",
					"Thursday", "Friday", "Saturday"];
	provide({
    getDayName: function(number) {
      return names[number];
    },
    getDayNumber: function(name) {
      for (var number = 0; number < names.length; number++) {
        if (names[number] == name)
          return number;
      }
    }
  });
})();				

function provide(values){
	forEachIn(values, function(name, value){
		window[name] = value;
	});
}


function forEachIn(object, action)
{
	for(var property in object){
		if(object.hasOwnProperty(property)){
			action(property, object[property]);
		}
	}
}
	
function buildMonthNameModule() {
  var names = ["January", "February", "March", "April",
               "May", "June", "July", "August", "September",
               "October", "November", "December"];
  function getMonthName(number) {
    return names[number];
  }
  function getMonthNumber(name) {
    for (var number = 0; number < names.length; number++) {
      if (names[number] == name)
        return number;
    }
  }

  window.getMonthName = getMonthName;
  window.getMonthNumber = getMonthNumber;
}
buildMonthNameModule();

var month = window.getMonthName(10);
document.write(month);


var loadedFiles = [];
var dependencies =
  {"ObjectTools.js": ["FunctionalTools.js"],
   "Dictionary.js":  ["ObjectTools.js"],
   "TestModule.js":  ["FunctionalTools.js", "Dictionary.js"]};

function load(file){
	document.write("load file : " + file);
	document.write("<br>");
}
  
function require(file){
	if(dependencies[file]){
		var files = dependencies[file];
		for(var i = 0; i<files.length; i++){
			require(files[i]);
		}
	}
	if(!loadedFiles[file]){
		loadedFiles[file] = true;
		load(file);
	}
}

require("TestModule.js");

eval(document.write("I am a string inside a string!"));
